using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vSale_Dsicount_HistoryMap : EntityTypeConfiguration<vSale_Dsicount_History>
    {
        public vSale_Dsicount_HistoryMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Id, t.DESC });

            // Properties
            this.Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Item)
                .HasMaxLength(10);

            this.Property(t => t.DESC)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.VENDITEMNO)
                .HasMaxLength(20);

            this.Property(t => t.CUSTOMV2)
                .HasMaxLength(30);

            this.Property(t => t.CUSTOMV3)
                .HasMaxLength(30);

            this.Property(t => t.INVNO)
                .HasMaxLength(7);

            // Table & Column Mappings
            this.ToTable("vSale_Dsicount_History");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Item).HasColumnName("Item");
            this.Property(t => t.Discountate).HasColumnName("Discountate");
            this.Property(t => t.TillDate).HasColumnName("TillDate");
            this.Property(t => t.Old_Price).HasColumnName("Old Price");
            this.Property(t => t.New_Price).HasColumnName("New Price");
            this.Property(t => t.DESC).HasColumnName("DESC");
            this.Property(t => t.VENDITEMNO).HasColumnName("VENDITEMNO");
            this.Property(t => t.CUSTOMV2).HasColumnName("CUSTOMV2");
            this.Property(t => t.CUSTOMV3).HasColumnName("CUSTOMV3");
            this.Property(t => t.INVNO).HasColumnName("INVNO");
            this.Property(t => t.SoldQty).HasColumnName("SoldQty");
        }
    }
}
